<include file="public/header" title="我的拼团订单" body="g4"/>
<include file="public/header_nav" title="我的拼团订单" href="{:U('User/index')}"/>
<div class="tit-flash-sale p mytit_flash">
    <div class="addset-wrap-h">
        <ul class="addset-h">
            <li <if condition="$Request.param.type eq ''">class="red"</if>>
                <a href="{:U('/Mobile/Order/team_list')}" class="tab_head">全部订单</a>
            </li>
            <li id="WAITPAY" <if condition="$Request.param.type eq 'WAITPAY'">class="red"</if>">
                <a href="{:U('/Mobile/Order/team_list',array('type'=>'WAITPAY'))}" class="tab_head" >待付款</a>
            </li>
            <li id="WAITTEAM" <if condition="$Request.param.type eq 'WAITTEAM'">class="red"</if>">
            <a href="{:U('/Mobile/Order/team_list',array('type'=>'WAITTEAM'))}" class="tab_head" >待成团</a>
            </li>
            <li id="WAITSEND" <if condition="$Request.param.type eq 'WAITSEND'">class="red"</if>>
                <a href="{:U('/Mobile/Order/team_list',array('type'=>'WAITSEND'))}"  class="tab_head">待发货</a>
            </li>
            <li id="WAITRECEIVE"  <if condition="$Request.param.type eq 'WAITRECEIVE'">class="red"</if>>
                <a href="{:U('/Mobile/Order/team_list',array('type'=>'WAITRECEIVE'))}" class="tab_head">待收货</a>
            </li>
            <li id="WAITCCOMMENT"  <if condition="$Request.param.type eq 'WAITCCOMMENT'">class="red"</if>>
                <a href="{:U('/Mobile/Order/team_list',array('type'=>'WAITCCOMMENT'))}" class="tab_head">已完成</a>
            </li>
        </ul>
    </div>
</div>

<!--订单列表-s-->
<div class="ajax_return">
    <empty name="order_list">
        <!--没有内容时-s--->
        <div class="comment_con p">
            <div class="none">
                <img src="__STATIC__/images/none2.png">
                <br><br>抱歉未查到数据！
                <div class="paiton">
                    <div class="maleri30">
                        <a class="soon" href="{:U('Index/index')}"><span>去逛逛</span></a>
                    </div>
                </div>
            </div>
        </div>
    <!--没有内容时-e--->
    <else/>
        <volist name="order_list" id="order">
            <div class="mypackeg ma-to-20 getmore">
                <div class="packeg p">
                    <div class="maleri30">
                        <div class="fl">
                            <p class="bgnum"><span>订单编号:</span><span>{$order[order_sn]}</span></p>
                        </div>
                        <div class="fr">
                            <span>{$order[order_status_detail]}</span>
                        </div>
                    </div>
                </div>
                <div class="shop-mfive p">
                    <div class="maleri30">
                        <volist name="order[order_goods]" id="goods">
                            <div class="sc_list se_sclist paycloseto">
                                <a href="{:U('/Mobile/Order/team_detail',array('order_id'=>$order[order_id]))}">
                                <div class="shopimg fl">
                                    <img src="{$goods[goods_id]|goods_thum_images=200,200}">
                                </div>
                                <div class="deleshow fr">
                                    <div class="deletes">
                                        <span class="similar-product-text">{$goods[goods_name]|getSubstr=0,20}</span>
                                    </div>
                                    <div class="des-mes">
                                        <span class="similar-pro-text">{$goods[spec_key_name]}</span>
                                    </div>
                                    <div class="prices  wiconfine">
                                        <p class="sc_pri"><span>￥</span><span>{$goods[member_goods_price]}</span></p>
                                    </div>
                                    <div class="qxatten  wiconfine">
                                        <p class="weight"><span>数量</span>&nbsp;<span>{$goods[goods_num]}</span></p>
                                    </div>
                                    <div class="buttondde">
                                        <if condition="($order[order_button][return_btn] eq 1) and ($goods[is_send] lt 2)">
                                            <a href="{:U('Mobile/Order/return_goods',['rec_id'=>$goods['rec_id']])}">申请售后</a>
                                        </if>
                                    </div>
                                </div>
                                </a>
                            </div>
                        </volist>
                    </div>
                </div>
                <div class="shop-rebuy-price p">
                    <div class="maleri30">
                        <span class="price-alln">
                            <span class="threel">共{$order[order_goods]|count}件商品</span>
                                <!--实付款：<span class="red">￥{$order['order_amount']}</span>-->
                                订单总价：<span class="red">￥{$order[total_amount]}</span>
                                <span class="threel">(含运费￥{$order[shipping_price]})</span>
                        </span>
                    </div>
                </div>
                <div class="shop-rebuy-price p">
                    <div class="maleri30">
                        <if condition="$order.order_button[pay_btn] eq 1">
                            <a class="shop-rebuy paysoon" href="{:U('Mobile/Team/order',array('order_id'=>$order[order_id]))}">立即付款</a>
                        </if>
                        <if condition="$order.order_button[cancel_btn] eq 1 && $order.pay_status eq 0">
                            <a class="shop-rebuy " onClick="cancel_order({$order.order_id})">取消订单</a>
                        </if>
                        <if condition="$order.order_button[receive_btn] eq 1">
                            <a class="shop-rebuy paysoon"  onclick="order_confirm({$order['order_id']})">确认收货</a>
                        </if>
                        <if condition="$order.order_button[comment_btn] eq 1">
                            <a class="shop-rebuy" href="{:U('Mobile/Order/comment',['status'=>0])}">评价晒单</a>
                        </if>
                        <if condition="$order.order_button[shipping_btn] eq 1">
                            <a class="shop-rebuy" href="{:U('Mobile/Order/express',array('order_id'=>$order['order_id']))}">查看物流</a>
                        </if>
                    </div>
               </div>
            </div>
        </volist>
    </empty>
</div>
<!--订单列表-e-->
<!--加载更多-s-->
<notempty name="order_list">
    <div id="getmore"  style="font-size:.32rem;text-align: center;color:#888;padding:.25rem .24rem .4rem; clear:both;display: none">
        <a >已显示完所有记录</a>
    </div>
</notempty>
<script type="text/javascript" src="__STATIC__/js/sourch_submit.js"></script>
<script type="text/javascript">

    /**
     * 确认收货
     * @param orderId
     */
    function order_confirm(orderId)
    {
        if(!confirm("确定收货?"))
            return false;
        $.ajax({
            url:"{:U('Order/order_confirm')}",
            type:'POST',
            dataType:'JSON',
            data:{id:orderId},
            success:function(data){
                if(data.status == 1){
                    layer.open({content:data.msg, time:2 ,end:function(){
                        location.href ='/index.php?m=mobile&c=Order&a=team_detail&order_id='+orderId;
                    }});
                }else{
                    layer.open({content:data.msg, time:2,end:function(){
                        location.href ='/index.php?m=mobile&c=Order&a=team_list&type={$Request.param.type}&p={$Request.param.p}';
                    }});
                }
            },
            error : function() {
                layer.open({content:'网络失败，请刷新页面后重试', time: 2});
            }
        })
    }

    /**
     * 取消订单
     */
    function cancel_order(id){
        if(!confirm("确定取消订单?"))
            return false;
        $.ajax({
            type: 'GET',
            url:"/index.php?m=Mobile&c=Order&a=cancel_order&id="+id,
            dataType:'JSON',
            success:function(data){
                if(data.status == 1){
                    layer.open({content:data.msg,time:2});
                    location.href = "/index.php?m=Mobile&c=Order&a=team_list";
                }else{
                    layer.open({content:data.msg,time:2});
                    return false;
                }
            },
            error:function(){
                layer.open({content:'网络失败，请刷新页面后重试',time:3});
            }
        });
    }

    var page = 1;
    /**
     *加载更多
     */
    function ajax_sourch_submit()
    {
        page += 1;
        $.ajax({
            type : "GET",
            url:"/index.php?m=Mobile&c=Order&a=team_list&type={$Request.param.type}&p="+page,//+tab,
            success: function(data)
            {
                if(data == '') {
                    $('#getmore').show();
                    return false;
                }else{
                    $(".ajax_return").append(data);
                    $(".m_loading").hide();
                }
            }
        });
    }
</script>
</body>
</html>
